package some.black.dao;

import java.util.List;
import java.util.Map;

import org.mybatis.spring.support.SqlSessionDaoSupport;
import org.springframework.stereotype.Component;

import some.black.domain.BlackCommand;
import some.black.domain.BlockMemberCommand;

@Component
public class BlackDaoImpl extends SqlSessionDaoSupport implements BlackDao{

	@Override
	public void insertBlack(BlackCommand blackCommand) {
		getSqlSession().insert("BlackDao.insertBlack",blackCommand);
	}

	@Override
	public List<BlackCommand> getBlackList(Map<String,Object> map) {
		List<BlackCommand> list = getSqlSession().selectList("BlackDao.blackList",map);
		return list;
	}

	@Override
	public int getBlackCount(Map<String,Object> map) {
		int count = getSqlSession().selectOne("BlackDao.getBlackCount",map);
		return count;
	}

	@Override
	public BlackCommand getBlackCommand(int num) {
		BlackCommand blackCommand = getSqlSession().selectOne("BlackDao.getBlackCommand",num);
		return blackCommand;
	}

	@Override
	public int getReportCount(String id) {
		return getSqlSession().selectOne("BlackDao.getReportCount",id);
	}

	@Override
	public void insertBlockMember(BlockMemberCommand blockMember) {
		getSqlSession().insert("BlackDao.insertBlockMember", blockMember);
	}

	@Override
	public int checkBlockMember(String id) {
		return getSqlSession().selectOne("BlackDao.checkBlockMember", id);
	}

	@Override
	public int checkBlockDate(String id) {
		return getSqlSession().selectOne("BlackDao.checkBlockDate", id);
	}

	@Override
	public void deleteBlockMember(String id) {
		getSqlSession().delete("BlackDao.deleteBlockMember", id);
	}
	
	@Override
	public void setBlockGrade(String id) {
		getSqlSession().update("BlackDao.setBlockGrade",id);
	}

	@Override
	public void setNoBlockGrade(String id) {
		getSqlSession().update("BlackDao.setNoBlockGrade",id);
	}
	
	@Override
	public BlockMemberCommand getBlockMember(String id) {
		BlockMemberCommand blockMember = getSqlSession().selectOne("BlackDao.getBlockMember", id);
		return blockMember;
	}

}
